package com.deepclassifieds.daas.common.util;

import java.util.Locale;
import java.util.ResourceBundle;

import com.deepclassifieds.daas.common.Reject;

public final class ResourceBundleUtils {

	private ResourceBundleUtils() {
	}
	
	public static ResourceBundle loadResourceBundle(Class<?> clazz, String propsName, Locale locale) {
		Reject.ifNull(clazz);
		Reject.ifNull(propsName);
		String baseName = clazz.getPackage().getName() + "." + propsName;
		return ResourceBundle.getBundle(baseName, locale);
		
//		Properties props = new Properties();
//        URL url = ClassLoader.getSystemResource(propsName);
//        if(url == null) {
//			throw new RuntimeException("Cannot find properties '" + propsName + 
//					"' in classpath, see nested...");
//        }
//        try {
//			props.load(url.openStream());
//		} catch (IOException ex) {
//			throw new RuntimeException("Cannot load properties '" + propsName + 
//					"' from classpath, see nested...", ex);
//		}
//        return props;		
	}
}
